package com.jzr.mybatis.generator;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;

import java.util.Scanner;

public class InputHelper {
    public static String scanner(String tip) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder help = new StringBuilder();
        help.append("请输入" + tip + "(##结束输入)：");
        System.out.println(help.toString());
        StringBuilder input = new StringBuilder();
        if (scanner.hasNext()) {
            while(true) {
                String ipt = scanner.next();
                if(ipt.equalsIgnoreCase("##")){
                    break;
                }
                if (StringUtils.isNotEmpty(ipt)) {
                    input.append(ipt);
                }
            }
        }
        return input.toString();
    }
}
